global _viewFile
_viewFile = None
def OpenViewFile(name):
  global _viewFile
  if _viewFile: _viewFile.close()
  _viewFile = open(name, "w")


def CloseViewFile():
  global _viewFile
  if _viewFile:
    _viewFile.close()
    _viewFile = None 


def PrintView(obj):
  global _viewFile
  if _viewFile: 
    _viewFile.write(str(obj)+"\n")

def UserInit():
  OpenViewFile("VIEW.TXT")
        
def UserCleanup():
  CloseViewFile()